﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using Waker.Entitys;

namespace Waker.BAL
{
    public class BAL_Device : BAL_Base
    {
        #region 门禁设备
        public DataTable GetDeviceByID(string dId)
        {
            return new DAL.DAL_Device().GetDeviceByID(dId);
        }
        public bool SaveDevice(string Device_ID, string Physics_ID, string Device_Name, string Device_Type, string Device_Desc, string comAdapter_ID, string IP, string port, string pwd, List<ADSHalDataStruct.ADS_LogicSubDeviceInformation> listSubs)
        {
            return new DAL.DAL_Device().SaveDevice(Device_ID, Physics_ID, Device_Name, Device_Type, Device_Desc, comAdapter_ID, IP, port, pwd, listSubs);
        }
        public bool CheckDevice(string ip, int port, string physics_ID)
        {
            return new DAL.DAL_Device().CheckDevice(ip, port, physics_ID);
        }
        public DataSet GetDeviceAll()
        {
            return new DAL.DAL_Device().GetDeviceAll();
        }
        public DataTable GetDeviceAndComadpater()
        {
            return new DAL.DAL_Device().GetDeviceAndComadpater();
        }
        public DataTable GetAllDeviceIDAndName()
        {
            return new DAL.DAL_Device().GetAllDeviceIDAndName();
        }
        public bool SetSubDeviceOpenTime(string dId, UInt32 time)
        {
            return new DAL.DAL_Device().SetSubDeviceOpenTime(dId, time);
        }
        public bool SetSubDeviceOpenTimeOut(string dId, UInt32 time)
        {
            return new DAL.DAL_Device().SetSubDeviceOpenTimeOut(dId, time);
        }
        public bool ClearIsUpload()
        {
            return new DAL.DAL_Device().ClearIsUpload();
        }
        public DataTable GetLSubDeviceById(string id)
        {
            return new DAL.DAL_Device().GetLSubDeviceById(id);
        }
        public DataTable GetSubDeviceByDeviceID(string deviceID)
        {
            return new DAL.DAL_Device().GetSubDeviceByDeviceID(deviceID);
        }
        public bool updateSubDeviceSetting(string LSubDevice_ID, int OpenTime, int OpenTimeOut, bool IsUseNVR, string NVRIp, int NVRChannel, int NVRPort, string NVRUsrName, string NVRPwd)
        {
            return new DAL.DAL_Device().updateSubDeviceSetting(LSubDevice_ID, OpenTime, OpenTimeOut, IsUseNVR, NVRIp, NVRChannel, NVRPort, NVRUsrName, NVRPwd);
        }
        //public bool updateSubDeviceSetting(string LSubDevice_ID, int OpenTime, int OpenTimeOut, bool IsUseNVR, int NVR_ID, int NVRChannel, string LSubDevice_Name)
        //{
        //    return new DAL.DAL_Device().updateSubDeviceSetting(LSubDevice_ID, OpenTime, OpenTimeOut, IsUseNVR, NVR_ID, NVRChannel, LSubDevice_Name);
        //}
        public bool DeleteDevice(string devicecId)
        {
            return new DAL.DAL_Device().DeleteDevice(devicecId);
        }
        #endregion
        #region 通行时段
        public DataTable GetAllTimePeriod()
        {
            return new DAL.DAL_Device().GetAllTimePeriod();
        }
        public bool DeleteTimePeriod(byte id)
        {
            return new DAL.DAL_Device().DeleteTimePeriod(id);
        }
        public DataTable GetTimePeriodByID(byte id)
        {
            return new DAL.DAL_Device().GetTimePeriodByID(id);
        }
        public bool SaveTimePeriod(DataRow dr)
        {
            return new DAL.DAL_Device().SaveTimePeriod(dr);
        }
        #endregion
        #region 安全教育
        public DataTable GetAllSafeTimePeriod()
        {
            return new DAL.DAL_Device().GetAllSafeTimePeriod();
        }
        public bool DeleteSafeTimePeriod(int id)
        {
            return new DAL.DAL_Device().DeleteSafeTimePeriod(id);
        }
        public DataTable GetSafeTimePeriodByID(int id)
        {
            return new DAL.DAL_Device().GetSafeTimePeriodByID(id);
        }
        public bool SaveSafeTimePeriod(DataRow dr)
        {
            return new DAL.DAL_Device().SaveSafeTimePeriod(dr);
        }
        #endregion

        #region 视频管理
        public DataTable GetNVRByID(int nId)
        {
            return new DAL.DAL_Device().GetNVRByID(nId);
        }
        public bool SaveNVR(int id, string name, string ip, int port, string userName, string pwd, string
            remark)
        {
            return new DAL.DAL_Device().SaveNVR(id, name, ip, port, userName, pwd, remark);
        }
        public bool DeleteNVR(int nid)
        {
            return new DAL.DAL_Device().DeleteNVR(nid);
        }
        #endregion
    }
}
